package com.itbaizhan.repository;

import com.itbaizhan.entity.Position;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/*JpaRepository :继承它能使用它里面很多操作数据库的方法*/
public interface PositionRepository extends JpaRepository<Position,Long> {
    @Query(nativeQuery=true, value="select p.id,p.name,p.salary,p.city,pd.description from position p join position_detail pd on(pd.pid=p.id) where p.id=:id")
    public Object findPositionById(@Param("id") long id);
}
